import request from '@/utils/request'
// 获取员工列表
export const employeeList = (params) => {
  return request.get('/sys/user', { params })
}

// excel导出
export const exportExcel = () => {
  return request({
    url: '/sys/user/export',
    responseType: 'blob'
  })
}

// 下载模板
export const getTemplates = () => {
  return request({
    url: '/sys/user/import/template',
    responseType: 'blob'
  })
}

// 导入员工
export const importUser = (data) => {
  return request.post('/sys/user/import', data)
}
// 删除员工
export const delUser = (id) => {
  return request.delete(`/sys/user/${id}`)
}

// 新增员工
export const addUser = (data) => {
  console.log(data)
  return request.post('/sys/user', data)
}
// 编辑员工
export const updateUser = (data) => {
  return request.put(`/sys/user/${data.id}`, data)
}
// 获取基本信息
export const getInfo = (id) => {
  return request.get(`/sys/user/${id}`)
}
// 获取已启用的角色列表
export const getEnableRoleList = () => {
  return request.get('/sys/role/list/enabled')
}

// 分配角色权限
export const putUserList = (data) => {
  return request.put('/sys/user/assignRoles', data)
}

